import Main from '@/views/main/main.vue'
import IFrame from '@/components/iframe/iframe.vue'
import ParentView from '@/components/parent-view/parent-view.vue'

/**
 * meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  auth: (system:role:ui) 可访问该页面的权限
 * }
 */


const Login = {
    path: '/login',
    name: 'login',
    meta: {
        hideInMenu: true
    },
    component: () =>
        import ('@/views/login/login.vue')
}

const Home = {
    path: '/',
    name: '_home',
    redirect: '/home',
    component: Main,
    meta: {
        hideInMenu: true
    },
    children: [{
        path: '/home',
        name: 'home',
        meta: {
            title: '首页',
            hideInMenu: true
        },
        component: () =>
            import ('@/views/dashboard/dashboard.vue')
    }]
}

const Profile = {
    path: '/profile',
    name: '_profile',
    meta: {
        title: '个人信息',
        hideInMenu: true
    },
    component: Main,
    children: [{
        path: '/profile',
        name: 'profile',
        meta: {
            title: '我的信息',
            hideInMenu: false
        },
        component: () =>
            import ('@/views/profile/index.vue')
    }]
}


const Biz = [
    {
        path: '/mall/settings',
        name: '_mall_settings',
        component: Main,
        meta: {
            title: '商城管理',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
            path: 'settingsFreight',
            name: '_settings_freight',
            meta: {
                title: '快递公司',
                icon: 'el-icon-location',
                auth: 'system:user:ui'
            },
            component: () =>
                import ('@/views/mall/settings/freight/index.vue')
        }, ]
    },
    {
        path: '/mall/goods',
        name: '_mall_goods',
        component: Main,
        meta: {
            title: '商品管理',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
                path: 'goodsList',
                name: '_goods_list',
                meta: {
                    title: '商品列表',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/goods/goods/index.vue')
            },
            {
                path: 'addGoods',
                name: '_add_goods',
                meta: {
                    title: '添加商品',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui',
                    hideInMenu: true,
                    hideInTags: true
                },
                component: () =>
                    import ('@/views/mall/goods/goods/add_goods.vue')
            },
            {
                path: 'category',
                name: 'category',
                meta: {
                    title: '商品分类',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/goods/category/index.vue')
            },
            {
                path: 'type',
                name: 'type',
                meta: {
                    title: '商品类型',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/goods/type/index.vue')
            },
            {
                path: 'brand',
                name: 'brand',
                meta: {
                    title: '商品品牌',
                    icon: 'el-icon-location',
                    auth: 'mall:goods:brand'
                },
                component: () =>
                    import ('@/views/mall/goods/brand/index.vue')
            },
            {
                path: 'spec',
                name: 'spec',
                meta: {
                    title: '商品规格',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/goods/spec/index.vue')
            },
            {
                path: 'specValue',
                name: '_spec_value',
                meta: {
                    title: '商品规格值',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui',
                    hideInMenu: true,
                    hideInTags: true
                },
                component: () =>
                    import ('@/views/mall/goods/spec/spec_value.vue')
            },
            {
                path: 'tags',
                name: 'tags',
                meta: {
                    title: '标签管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/goods/tags/index.vue')
            },
            {
                path: 'comments',
                name: '_comments',
                meta: {
                    title: '评价管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/goods/tags/index.vue')
            }
        ]
    },
    {
        path: '/mall/order',
        name: '_order',
        component: Main,
        meta: {
            title: '订单管理',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
                path: 'orderList',
                name: '_order_list',
                meta: {
                    title: '订单列表',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/order/order/index.vue')
            },
            {
                path: 'orderAfterSales',
                name: '_order_after_sales',
                meta: {
                    title: '售后订单',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/order/after_sales/index.vue')
            }
        ]
    },
    {
        path: '/mall/user',
        name: '_user',
        component: Main,
        meta: {
            title: '会员管理',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
                path: 'user',
                name: 'user',
                meta: {
                    title: '会员管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/user/user/index.vue')
            },
            {
                path: 'integral',
                name: '_integral',
                meta: {
                    title: '积分设置',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/user/integral/index.vue')
            },
            {
                path: 'address',
                name: '_address',
                meta: {
                    title: '地址管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/user/address/index.vue')
            }
        ]
    },
    {
        path: '/mall/spread',
        name: '_spread',
        component: Main,
        meta: {
            title: '推广服务',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
                path: 'advert',
                name: '_advert',
                meta: {
                    title: '广告管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/spread/advert/index.vue')
            },
            {
                path: 'advert_position',
                name: '_advert_position',
                meta: {
                    title: '广告位置',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/spread/advert_position/index.vue')
            },
            {
                path: 'notice',
                name: '_notice',
                meta: {
                    title: '公共管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/spread/notice/index.vue')
            }
        ]
    },
    {
        path: '/mall/report',
        name: '_report',
        component: Main,
        meta: {
            title: '数据分析',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
                path: 'reportUser',
                name: '_report_user',
                meta: {
                    title: '客户分析',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/report/user/index.vue')
            },
            {
                path: 'reportGoods',
                name: '_report_goods',
                meta: {
                    title: '商品分析',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/mall/report/goods/index.vue')
            }
        ]
    },

    // {
    //     path: '/weixin',
    //     name: '公众号管理',
    //     component: Main,

    //         hideInMenu: false,
    //         icon: 'el-icon-location'
    //     children: [
    //         {
    //             path: 'menu',
    //             name: '微信菜单',
    //             icon: 'el-icon-menu',
    //             component: () => import('@/views/weixin/menu/index'),
    //             redirect: '/weixin/menu/list',
    //             noDropDown: true,
    //             children: [
    //                 {
    //                     path: 'list',
    //                     name: '菜单列表',
    //                     component: () => import('@/views/weixin/menu/List'),
    //                 }
    //             ]
    //         },
        
    //     ]
    // },
    {
        path: '/weixin',
        name: '_weixin',
        component: Main,
        meta: {
            title: '公众号管理',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
                path: 'wx_menu',
                name: 'wx_menu',
                meta: {
                    title: '微信菜单',
                    icon: 'el-icon-location',
                    auth: 'system:menu:ui',
                },
                redirect: '/weixin/menu_list',
                component: () => import ('@/views/weixin/menu/index.vue')
            },
            {
                path: 'menu_list',
                name: 'menu_list',
                meta: {
                    title: '微信菜单列表',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui',
                    hideInMenu: true,
                    hideInTags: true
                },
                component: () => import ('@/views/weixin/menu/List.vue')
            },
            {
                path: 'menu_form',
                name: 'menu_form',
                meta: {
                    title: '菜单编辑',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui',
                    hideInMenu: true,
                    hideInTags: true
                },
                component: () => import ('@/views/weixin/menu/Form.vue')
            },


            {
                path: 'article',
                name: 'article',
                meta: {
                    title: '图文管理',
                    icon: 'el-icon-location',
                    auth: 'system:menu:ui',
                },
                redirect: '/weixin/article_list',
                component: () => import ('@/views/weixin/article/index.vue')
            },
            {
                path: 'article_list',
                name: 'article_list',
                meta: {
                    title: '图文列表',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui',
                    hideInMenu: true,
                    hideInTags: true
                },
                component: () => import ('@/views/weixin/article/List.vue')
            },
            {
                path: 'article_form',
                name: 'article_form',
                meta: {
                    title: '图文编辑',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui',
                    hideInMenu: true,
                    hideInTags: true
                },
                component: () => import ('@/views/weixin/article/Form.vue')
            },


            {
                path: 'article_group',
                name: 'article_group',
                meta: {
                    title: '多图文管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/ArticleGroup.vue')
            },{
                path: 'keyword',
                name: 'keyword',
                meta: {
                    title: '关键字',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/Keyword.vue')
            },{
                path: 'subscribe',
                name: 'subscribe',
                meta: {
                    title: '关注回复编辑',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/Subscribe.vue')
            },{
                path: 'subscribe_user',
                name: 'subscribe_user',
                meta: {
                    title: '关注用户列表',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/SubscribeUser.vue')
            },{
                path: 'qrcode',
                name: 'qrcode',
                meta: {
                    title: '二维码管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/QrCode.vue')
            },{
                path: 'media',
                name: 'media',
                meta: {
                    title: '素材库管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/Media.vue')
            },{
                path: 'news_img',
                name: 'news_img',
                meta: {
                    title: '图文图片管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/NewsImg.vue')
            },{
                path: 'news',
                name: 'news',
                meta: {
                    title: '图文素材管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () => import ('@/views/weixin/News.vue')
            },
            
        ]
    },
    {
        path: '/system',
        name: '_system',
        component: Main,
        meta: {
            title: '系统管理',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
                path: 'menu',
                name: 'menu',
                meta: {
                    title: '菜单管理',
                    icon: 'el-icon-location',
                    auth: 'system:menu:ui',
                },
                component: () =>
                    import ('@/views/system/menu/menu.vue')
            },
            {
                path: 'role',
                name: 'role',
                meta: {
                    title: '角色管理',
                    icon: 'el-icon-location',
                    auth: 'system:role:ui'
                },
                component: () =>
                    import ('@/views/system/role/role.vue')
            },
            {
                path: 'user',
                name: 'user',
                meta: {
                    title: '用户管理',
                    icon: 'el-icon-location',
                    auth: 'system:user:ui'
                },
                component: () =>
                    import ('@/views/system/user/user.vue')
            },
            {
                path: 'online',
                name: 'online',
                meta: {
                    title: '在线用户',
                    icon: 'el-icon-location',
                    auth: 'system:menu:ui',
                },
                component: () =>
                    import ('@/views/system/online/online.vue')
            },
            {
                path: 'oss',
                name: 'oss',
                meta: {
                    title: '文件管理',
                    icon: 'el-icon-location'
                },
                component: () =>
                    import ('@/views/system/oss/oss.vue')
            },
            {
                path: 'area',
                name: 'area',
                meta: {
                    title: '地区管理',
                    icon: 'el-icon-location'
                },
                component: () =>
                    import ('@/views/system/area/index.vue')
            },
            {
                path: 'log',
                name: 'log',
                meta: {
                    title: '系统日志',
                    icon: 'el-icon-location'
                },
                component: () =>
                    import ('@/views/system/log/log.vue')
            },
            {
                path: 'elastic-console',
                name: 'elastic-console',
                meta: {
                    title: '任务管理',
                    icon: 'el-icon-location',
                    href: 'http://elastic-job.boot-mars.com'
                },
                component: IFrame
            },
            {
                path: 'rabbitmq',
                name: 'rabbitmq',
                meta: {
                    title: '消息队列',
                    icon: 'el-icon-location',
                    href: 'http://rabbitmq.boot-mars.com'
                },
                component: IFrame
            },
            {
                path: 'druid',
                name: 'druid',
                meta: {
                    title: '连接池监视',
                    icon: 'el-icon-location',
                    href: 'http://api.mall.com:7430/druid/sql.html'
                },
                component: IFrame
            }
        ]
    },
    {
        path: '/demo',
        name: '_demo',
        component: Main,
        meta: {
            title: 'DEMO 实例',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [{
            path: 'menugrid',
            name: 'menugrid',
            meta: {
                title: 'menugrid',
                icon: 'el-icon-location',
            },
            component: () => import ('@/views/demo/menu.vue')
        },{
            path: 'treegrid',
            name: 'treegrid',
            meta: {
                title: 'Treegrid',
                icon: 'el-icon-location',
            },
            component: () => import ('@/views/demo/treegrid.vue')
        }, {
            path: 'tinymce',
            name: 'tinymce',
            meta: {
                title: 'Tinymce',
                icon: 'el-icon-location',
            },
            component: () => import ('@/views/demo/tinymce.vue')
        }, {
            path: 'table',
            name: 'table',
            meta: {
                title: 'Table',
                icon: 'el-icon-location',
            },
            component: () => import ('@/views/demo/table.vue')
        }, {
            path: 'demo',
            name: 'demo',
            meta: {
                title: 'Demo',
                icon: 'el-icon-location',
            },
            component: () => import ('@/views/demo/demo.vue')
        }, {
            path: 'test',
            name: 'test',
            meta: {
                title: '测试页面',
                icon: 'el-icon-location',
                auth: 'system:menu:ui',
            },
            component: () =>
                import ('@/views/demo/test.vue')
        }]
    }
]

const Errors = [{
        path: '/errors',
        component: Main,
        name: 'ErrorPages',
        meta: {
            title: '错误',
            hideInMenu: true,
            icon: 'el-icon-location'
        },
        children: [{
                path: '401',
                name: '401',
                meta: {
                    title: '401',
                    hideInMenu: true,
                    icon: 'el-icon-location'
                },
                component: () =>
                    import ('@/views/errors/401.vue')
            },
            {
                path: '404',
                name: '404',
                meta: {
                    title: '404',
                    hideInMenu: true,
                    icon: 'el-icon-location'
                },
                component: () =>
                    import ('@/views/errors/404.vue')
            }
        ]
    },
    {
        path: '*',
        name: 'error_404',
        redirect: '/errors/404',
        meta: {
            hideInMenu: true
        }
    }
]

export default [
    Login,
    Home,
    Profile,
    ...Biz,
    ...Errors
]